-- stack: in -- format: 8 (HyperCard 1) -- flags: 0x1000 (none) -- protect password hash: 0 -- maximum user level: 5 (scripting) -- window: Rect(x1=0, y1=0, x2=0, y2=0) -- screen: Rect(x1=0, y1=0, x2=0, y2=0) -- card dimensions: w=0 h=0 -- scroll: x=0 y=0 -- background count: 2 -- first background id: 2774 -- card count: 16 -- first card id: 5444 -- list block id: 12172 -- print block id: 3518 -- font table block id: 0 -- style table block id: 0 -- free block count: 2 -- free size: 23520 bytes -- total size: 172032 bytes -- stack block size: 7680 bytes -- created by hypercard version: 0x01228000 -- compacted by hypercard version: 0x01228000 -- modified by hypercard version: 0x01228000 -- opened by hypercard version: 0x01258000 -- patterns[0]: 0x0000000000000000 -- patterns[1]: 0x8000000008000000 -- patterns[2]: 0x8800220088002200 -- patterns[3]: 0x8888222288882222 -- patterns[4]: 0x88AA22AA88AA22AA -- patterns[5]: 0xCCAA33AACCAA33AA -- patterns[6]: 0xEEAABBAAEEAABBAA -- patterns[7]: 0xEEBBBBEEEEBBBBEE -- patterns[8]: 0xFFBBFFEEFFBBFFEE -- patterns[9]: 0xFFBBFFFFFFBBFFFF -- patterns[10]: 0x8010022001084004 -- patterns[11]: 0xFFFFFFFFFFFFFFFF -- patterns[12]: 0x8822882288228822 -- patterns[13]: 0x1122448811224488 -- patterns[14]: 0xC4800C6843023026 -- patterns[15]: 0xB130031BD8C00C8D -- patterns[16]: 0xAA00AA00AA00AA00 -- patterns[17]: 0x8822552288225522 -- patterns[18]: 0x8855225588552255 -- patterns[19]: 0x77DD77DD77DD77DD -- patterns[20]: 0x8000000000000000 -- patterns[21]: 0xAA55AA55AA55AA55 -- patterns[22]: 0x038448300C020101 -- patterns[23]: 0x8244394482010101 -- patterns[24]: 0x8814224188412214 -- patterns[25]: 0x8080413E080814E3 -- patterns[26]: 0x22048C7422179810 -- patterns[27]: 0xBE808808EB088880 -- patterns[28]: 0x25C8328964244C92 -- patterns[29]: 0xA29C41BE2AC914EB -- patterns[30]: 0x40A00000040A0000 -- patterns[31]: 0x8040200002040800 -- patterns[32]: 0xAA00800088008000 -- patterns[33]: 0xFF80808080808080 -- patterns[34]: 0x081C22C180010204 -- patterns[35]: 0xF0F0F0F00F0F0F0F -- patterns[36]: 0xF87422478F172271 -- patterns[37]: 0xBF00BFBFB0B0B0B0 -- patterns[38]: 0xFF7FBE5DA2418000 -- patterns[39]: 0xFAF5FAF5A050A050 -- checksum: 0x0 ----- HyperTalk script ----- -- -- -- This stack and it's scripts and graphics are copyright 1989, -- Prophecy Software Inc. All rights reserved. -- -- You may examine this code for your own benifit. -- If you wish to make changes that enhance the stack please make -- them to a copy and contact us at: -- -- Prophecy Software Inc. -- 3650 Silverside Rd. Suite 3 -- Wilmington, DE 19810 -- (302) 994-1502 -- -- We will be happy to consider distributing an updated version with -- propper credit given to the author. distribution of copies of this -- stack with un-authorized alterations constitures copyright -- violation and fraud. on idle global my_choice, last_message, hit_count global bs, su, tt, pt, ca put read_message() into the_message if the_message is empty then exit idle if offset(numtochar(5), the_message) is not 0 then get send_message(last_message && "•") exit idle end if -- test for read of entire the_message put the number of chars in the_message into the_length if char the_length of the_message is not "•" then get send_message(numtochar(5)) exit idle end if put word 1 of the_message into command -- move, query to ship at this location if command is "move" then put "Incoming..." into card field 1 of card "enemy board" put word 2 of the_message into value put field value of card "player board" into the_letter put "re" && value && the_letter into last_message if the_letter is not "" then go to card "player Card" play boom set icon of button value to 7009 get flash("Hit") else go to card "player Card" play splash set icon of button value to 19123 get flash ("Miss") end if get send_message ("re" && value && the_letter && "•") exit idle end if -- results, answer to a move query if command is "re" then put word 2 of the_message into value put word 3 of the_message into shot if shot is not "•" then put "Tower Reports Hit..." into card field 1 of card "enemy board" play boom set icon of button value of card "enemy board" to 7009 if shot is "B" then add 1 to bs if bs is 5 then set hilite of card button bas of card "enemy board" to true end if if shot is "C" then add 1 to ca if ca is 4 then set hilite of card button car of card "enemy board" to true end if if shot is "T" then add 1 to tt if tt is 3 then set hilite of card button ttr of card "enemy board" to true end if if shot is "S" then add 1 to su if su is 3 then set hilite of card button sub of card "enemy board" to true end if if shot is "P" then add 1 to pt if pt is 2 then set hilite of card button ptb of card "enemy board" to true end if add 1 to hit_count if hit_count is 17 then get send_message("win" && "•") put "win" into last_message put "The Enemy is Defeated!" & return & "---Game Over---" into card field 1 of card "enemy board" go to card "enemy board" end if else put "Tower Reports Miss..." into card field 1 of card "enemy board" play splash set icon of button value of card "enemy board" to 19123 end if get send_message("go" && "•") put "go" into last_message exit idle end if if command is "sm" then put the number of words in the_message into count subtract 1 from count put word 2 to count of the_message into the_message put the_message into card field 1 of card "enemy board" exit idle end if if command is "go" then show button 65 of card "enemy board" go to card "enemy board" put "Your Move" & numtochar(13) into card field 1 of card "enemy board" put "Press on Tile to Fire" after card field 1 of card "enemy board" exit idle end if -- start determine who goes first if command is "st" then put word 2 of the_message into value if my_choice > value then show button 65 of card "enemy board" put "Your Move" into card field 1 of card "enemy board" else if my_choice < value then get send_message("go" && "•") -- other player goes first put "go" into last_message hide button 65 of card "enemy board" put "Please Wait..." into card field 1 of card "enemy board" end if exit idle end if if command is "win" then go to card "enemy board" put "You Lose" into card field 1 of card "enemy board" play trumpet g3 g c4w g3q c4 ew g3q c4 g4h eh c g3 g c4w exit idle end if if command is "done" then show card field 1 of card "player board" exit idle end if if command is "at" then put word 2 of the_message into value get icon of button value of card "enemy board" if it is 0 then set icon of button value of card "enemy board" to 30874 end if exit idle end if -- unknown command, send query get readmodem() get send_message(numtochar(5)) end idle on OpenStack global my_choice, whom put random(10) into my_choice get openmodem() get resetmodem(1200, 8, "n", 1) put "" into card field "message" of card "computer card" put empty into whom end OpenStack function read_message global opponent if opponent is "computer" then get card field "message" of card "computer Card" put "" into card field "message" of card "computer card" return it else get readmodem() if it is 0 then return empty put it into the_message get readmodem() if it is not 0 then put the_message & it into the_message -- if the computer is playing agains the other machine for us -- then we must reverse the roll of this routine. i.e. read data -- goes to the computer not the player. -- if opponent is "CVSC" then put the_message into card field "data" of card "computer card" send com_turn to card "computer card" return empty end if return the_message end if return empty end read_message function send_message the_message global opponent if opponent is not "computer" then get writemodem(the_message) if opponent is "CVSC" then send com_turn to card "computer card" end if exit send_message end if -- computers turn here put the_message into card field "data" of card "computer card" send com_turn to card "computer card" end send_message function flash the_words put 1 into count repeat while count < 5 put "" into card field 65 of card "Player card" wait 5 ticks put the_words into card field 65 of card "player card" add 1 to count wait 5 ticks end repeat put "" into card field 65 of card "Player card" end flash